import { BasicColumn, FormSchema } from '/@/components/Table';
import dayjs from 'dayjs';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
export const columns: BasicColumn[] = [
  {
    title: '学生姓名',
    dataIndex: 'name',
    align: 'center',
    width: 120,
  },
  {
    title: '学生卡号',
    dataIndex: 'stid',
    align: 'center',
    width: 120,
  },
  {
    title: '卡号硬件id',
    dataIndex: 'cid',
    align: 'center',
    width: 120,
  },
  {
    title: '房间号',
    dataIndex: 'room',
    align: 'center',
    width: 120,
  },
  {
    title: '身份证号',
    dataIndex: 'idcard',
    align: 'center',
    width: 120,
  },
  {
    title: '一卡通账户',
    dataIndex: 'account',
    align: 'center',
    width: 120,
  },
  {
    title: '生效时间',
    dataIndex: 'stime',
    align: 'center',
    width: 180,
  },
  {
    title: '失效时间',
    dataIndex: 'etime',
    align: 'center',
    width: 180,
  },
  {
    title: '当前状态',
    dataIndex: 'state',
    align: 'center',
    width: 120,
    customRender: ({ text }) => {
      return h(Tag, { color: text == 1 ? 'green' : text == -2 ? 'red' : 'gray' }, () => (text == 1 ? '有效' : text == -2 ? '黑名单' : '--'));
    },
  },
  {
    title: 'pid',
    dataIndex: 'pid',
    align: 'center',
    width: 120,
  },
  {
    title: '注册时间',
    dataIndex: 'rtime',
    align: 'center',
    width: 180,
  },
  {
    title: '更新时间',
    dataIndex: 'utime',
    align: 'center',
    width: 180,
  },
  {
    title: '终端号',
    dataIndex: 'terminalno',
    align: 'center',
    width: 120,
  },
  {
    title: '操作人员',
    dataIndex: 'optr',
    align: 'center',
    width: 120,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'room',
    label: '房间号',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'stid',
    label: '学生卡号',
    component: 'Input',
    colProps: { span: 6 },
  },
];

export const formSchema: FormSchema[] = [
  {
    label: '学生卡号',
    field: 'stid',
    component: 'Input',
  },
  {
    label: '房间号',
    field: 'room',
    component: 'Input',
  },
];
